﻿//----------------------------------------------------------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Keith B. Rimington">
//
//   Copyright (c) 2011 Keith B. Rimington
//
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
//     documentation files (the "Software"), to deal in the Software without restriction, including without limitation
//     the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
//     to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
//   The above copyright notice and this permission notice shall be included in all copies or substantial portions of
//     the Software.
//
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//     THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
//     CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//     DEALINGS IN THE SOFTWARE.
//
// </copyright>
//----------------------------------------------------------------------------------------------------------------------

namespace Noc.Pomodoro
{
    using System.Windows;

    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        /*
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        using (var model = new Models.PomodoroDb())
        {
            model.PomoEvents.ToList().ForEach(v => model.PomoEvents.DeleteObject(v));
            model.Pomodoros.ToList().ForEach(p => model.Pomodoros.DeleteObject(p));
            model.Tasks.ToList().ForEach(t => model.Tasks.DeleteObject(t));
            model.SaveChanges();

            Models.Task task;
            Models.Pomodoro pomodoro;

            #region // Task A

            model.Tasks.AddObject(task = new Models.Task()
            {
                Id = Guid.NewGuid(),
                Title = "Task A",
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(8),
                TaskTypeId = (int)Lookup.TaskType.Planned,
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.Completed,
                Started = DateTime.Today.AddHours(8),
                Stopped = DateTime.Today.AddHours(8.45),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9),
            });

            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(1), TypeId = (int)Lookup.PomodoroEventType.Start });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(2), TypeId = (int)Lookup.PomodoroEventType.InternalInterrupt });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(3), TypeId = (int)Lookup.PomodoroEventType.InternalInterrupt });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(4), TypeId = (int)Lookup.PomodoroEventType.ExternalInterrupt });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(5), TypeId = (int)Lookup.PomodoroEventType.Complete });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = false,
                StateId = (int)Lookup.PomodoroState.Completed,
                Started = DateTime.Today.AddHours(8.5),
                Stopped = DateTime.Today.AddHours(8.95),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(1), TypeId = (int)Lookup.PomodoroEventType.Start });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(2), TypeId = (int)Lookup.PomodoroEventType.InternalInterrupt });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(3), TypeId = (int)Lookup.PomodoroEventType.Complete });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = false,
                Started = DateTime.Now,
                StateId = (int)Lookup.PomodoroState.Running,
                Created = DateTime.Now,
                Modified = DateTime.Now,
            });

            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(1), TypeId = (int)Lookup.PomodoroEventType.Start });
            pomodoro.PomoEvents.Add(new Models.PomoEvent() { Id = Guid.NewGuid(), Date = pomodoro.Created.AddMinutes(2), TypeId = (int)Lookup.PomodoroEventType.ExternalInterrupt });

            #endregion // Task A

            #region // Task B

            model.Tasks.AddObject(task = new Models.Task()
            {
                Id = Guid.NewGuid(),
                Title = "Task B",
                Created = DateTime.Today.AddHours(8.1),
                Modified = DateTime.Today.AddHours(8.1),
                TaskTypeId = (int)Lookup.TaskType.Canceled,
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                Started = DateTime.Today.AddHours(9),
                Stopped = DateTime.Today.AddHours(9.45),
                StateId = (int)Lookup.PomodoroState.Completed,
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = false,
                StateId = (int)Lookup.PomodoroState.Voided,
                Started = DateTime.Today.AddHours(9.5),
                Stopped = DateTime.Today.AddHours(9.6),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.6),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = false,
                StateId = (int)Lookup.PomodoroState.Voided,
                Started = DateTime.Today.AddHours(9.6),
                Stopped = DateTime.Today.AddHours(9.8),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.8),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = false,
                StateId = (int)Lookup.PomodoroState.NotStarted,
                Started = DateTime.Today.AddHours(10),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(10),
            });

            #endregion // Task B

            #region // Task C

            model.Tasks.AddObject(task = new Models.Task()
            {
                Id = Guid.NewGuid(),
                Title = "Task C",
                Created = DateTime.Today.AddHours(8.2),
                Modified = DateTime.Today.AddHours(8.2),
                TaskTypeId = (int)Lookup.TaskType.Completed,
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.Voided,
                Started = DateTime.Today.AddHours(9),
                Stopped = DateTime.Today.AddHours(9.2),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.2),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.Completed,
                Started = DateTime.Today.AddHours(11),
                Stopped = DateTime.Today.AddHours(11.45),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(11.45),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.Running,
                Started = DateTime.Today.AddHours(11.5),
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(11.5),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.NotStarted,
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            #endregion // Task C

            #region // Task D

            model.Tasks.AddObject(task = new Models.Task()
            {
                Id = Guid.NewGuid(),
                Title = "Task D",
                Created = DateTime.Today.AddHours(8.3),
                Modified = DateTime.Today.AddHours(8.3),
                TaskTypeId = (int)Lookup.TaskType.UrgentUnplanned,
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.NotStarted,
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            #endregion // Task D

            #region // Task E

            model.Tasks.AddObject(task = new Models.Task()
            {
                Id = Guid.NewGuid(),
                Title = "Task E",
                Created = DateTime.Today.AddHours(8.4),
                Modified = DateTime.Today.AddHours(8.4),
                TaskTypeId = (int)Lookup.TaskType.Activity,
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.NotStarted,
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            task.Pomodoros.Add(pomodoro = new Models.Pomodoro()
            {
                Id = Guid.NewGuid(),
                IsPlanned = true,
                StateId = (int)Lookup.PomodoroState.NotStarted,
                Created = DateTime.Today.AddHours(8),
                Modified = DateTime.Today.AddHours(9.5),
            });

            #endregion // Task E

            model.SaveChanges();
        }
    }
        //*/
    }
}